<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <style>
     #div_1{
	   width:200px;
	   height:200px;
	   background-color:red;
	   text-align:center;
	   line-height:200px;
	 }

  </style>
 </head>
 <body>
    <div id="div_1">qweqeq</div> 
	<button id="btn">变色</button>
 </body>
   <script>
      var div = document.getElementById("div_1");
	  btn = document.getElementById("btn");
	  btn.addEventListener("click",function(){ 
	  if(div.style.backgroundColor == ""){
	     div.style.backgroundColor = "blue";
	  }
	  else if(div.style.backgroundColor == "blue"){
	     div.style.backgroundColor = "red";
	  }else{
	     div.style.backgroundColor = "blue";
	  }
	  })
   </script>
</html>
